import { createStore } from 'vuex'
/**
 * 创建仓库和导出
 */
export default createStore({
    state: {
        user:{
            uid:'311bd9dda2c936be2d1acc7e83369e8c',
            username: '石子韬',
            description: '泰安集团会计部',
            tele: '13566112899',
            loc: '辽宁省-沈阳市-和平区-西京街132号泰安集团'
        },
         shoppings:[
            {
                shoppingCode: "G690BJMBXYW9BG70929258",
                shoppingNum:1,
                shoppingName: "爆浆面包香芋味",
                shoppingPrice: 6.00,
                manufacturers: "南宁市西乡塘区屯里村89号",
                expirationDate: "120天",
                vendor: "金添旺食品有限责任公司",
                note: "无",
                img:'https://img.alicdn.com/imgextrahttps://img.alicdn.com/imgextra/i2/2277382463/O1CN01JasX8F1U46IXMSwZk_!!2277382463-0-alimamacc.jpg_468x468q75.jpg_.webp'

            },
            {
                shoppingCode: "G690HSCNN9BG-2044889836",
                shoppingNum:1,
                shoppingName: "辉山纯牛奶",
                shoppingPrice: 2.00,
                manufacturers: "辉山乳业销售有限公司",
                expirationDate: "45天",
                vendor: "辽宁辉山乳业集团有限公司",
                note: "Pure Milk",
                img:"https://img.alicdn.com/imgextra/i3/4001295766/O1CN01vXX3V01sSsZPd6ZJc_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode:"G690JMMB9BG79915994",
                shoppingNum:1,
                shoppingName:  "酵母面包",
                shoppingPrice: 2.00,
                manufacturers: "桃李食品有限公司",
                expirationDate: "5天",
                vendor: "桃李面包股份有限公司",
                note: "吃头孢请勿吃这一款",
                img:"https://img.alicdn.com/imgextrahttps://img.alicdn.com/imgextra/i4/3416988900/O1CN01izX6uZ2FcFpw3eZyx_!!3416988900-0-alimamacc.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode: "G690NFSQ9BO74202353",
                shoppingNum:1,
                shoppingName: "农夫山泉",
                shoppingPrice: 3.00,
                manufacturers: "农夫山泉临江长白山饮用水有限公司",
                expirationDate: "24个月",
                vendor: "农夫山泉股份有限公司",
                note: "测试添加",
                img:"https://img.alicdn.com/imgextra/i3/3841766167/O1CN01OeufYm1vQXOLsQV99_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode: "G690QLJMB9BG79915994",
                shoppingNum:1,
                shoppingName:  "巧乐角面包",
                shoppingPrice: 4.00,
                manufacturers: "桃李食品有限公司",
                expirationDate: "1个月",
                vendor: "桃李面包股份有限公司",
                note: "美味小宇宙，柔软巧心思",
                img:"https://img.alicdn.com/imgextra/i2/131574112/O1CN01eeWzdW1gFLSflgWOD_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode: "G690RSMB9BG79915994",
                shoppingNum:1,
                shoppingName:  "肉松面包",
                shoppingPrice: 3.00,
                manufacturers: "桃李食品有限公司",
                expirationDate: "1个月",
                vendor: "桃李面包股份有限公司",
                note: "美味肉松",
                img:"https://img.alicdn.com/imgextra/i2/45488073/O1CN01eyrUsR29VUFP9y8Dg_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode: "G690TLQPMB9BG79915994",
                shoppingNum:1,
                shoppingName:  "桃李切片面包",
                shoppingPrice: 10.00,
                manufacturers: "桃李食品有限公司",
                expirationDate: "15天",
                vendor: "桃李面包股份有限公司",
                note: "美味切片",
                img:"https://img.alicdn.com/imgextra/i2/124679989/O1CN01leFNlo2Nf16q0KeVP_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            },
            {
                shoppingCode: "G690WXRDJZS9BO2679010",
                shoppingNum:1,
                shoppingName:  "外星人电解质水",
                shoppingPrice: 6.00,
                manufacturers: "安庆旺旺食品有限公司",
                expirationDate: "10个月",
                vendor: "外星人食品有限公司",
                note: "0糖0卡，就喝它",
                img:"https://img.alicdn.com/imgextra/i4/124130519/O1CN01GBlzBH1FhkPqU6q3w_!!0-saturn_solar.jpg_468x468q75.jpg_.webp"
            }
        ],
        order:{
            status:'可分配订单',
            type:'',
            recv: '',
            loc: '',
            tele: '',
            totalPay:0,
            shoppingList:[],
            newShoppingList:[],
            note:'',
            arriveTime:'',
            buyTime:''
        },
        InvoiceMsg:[]
    },
    mutations: {
        updateUserInfo(state, newData) {
            state.user = newData;
        },
        updateInvoiceMsgInfo(state, newData) {
            state.InvoiceMsg.push(newData);
        },
        removeInvoiceMsgInfo(state,newData){
            state.InvoiceMsg = []
        }
    },
    actions: {
        updateDataAction(context, newData) {
            context.commit('updateData', newData);
        }
    },
    getters: {
        getUserUid: state => state.user.uid,
        getUserLoc: state => state.user.loc,
        getUserTele: state => state.user.tele
    },
})
